<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>内容压缩</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <!-- 将内联样式分离到外部CSS文件 -->
    <link rel="stylesheet" href="styles/compression.css">
</head>
<body>
    <!-- Floating background elements -->
    <div class="floating-elements">
        <div class="floating-element"></div>
        <div class="floating-element"></div>
        <div class="floating-element"></div>
        <div class="floating-element"></div>
    </div>

    <!-- Header navigation -->
    <nav class="header-nav">
        <div class="nav-container">
            <div class="logo">Y-Squeeze</div>
            <ul class="nav-links">
                <li><a href="index.html" class="nav-link">首页</a></li>
                <li><a href="attention.html" class="nav-link">注意力分析</a></li>
                <li><a href="compression.html" class="nav-link active">内容压缩</a></li>
                <li><a href="generation.html" class="nav-link">样本生成</a></li>
                <li><a href="clustering.html" class="nav-link">聚类筛选</a></li>
            </ul>
        </div>
    </nav>

    <div class="container">
        <!-- Main Layout -->
        <div class="main-layout">
            <!-- Main Content -->
            <main class="main-content">
                <!-- Module Header -->
                <div class="module-header">
                    <h1 class="module-title">
                        <i class="fas fa-compress"></i>
                        内容压缩
                    </h1>
                    <div class="model-selector-container">
                        <label for="modelSelect" style="font-weight: 500; color: #4b5563;">模型:</label>
                        <select id="modelSelect" class="model-select">
                        </select>
                        <div class="model-dropdown" id="modelDropdown">
                            <div class="model-current">
                                <i class="fas fa-robot"></i>
                                <span class="model-name">选择模型</span>
                                <i class="fas fa-chevron-down caret"></i>
                            </div>
                            <div class="model-menu">
                            </div>
                        </div>
                    </div>
                </div>



                <!-- Compression Parameters -->
                <div class="compression-params" id="compressionParamsContainer">
                    <div class="params-header">
                        <div class="params-title">
                            <i class="fas fa-cog"></i>
                            压缩参数配置
                            <button class="toggle-params-btn" onclick="toggleParamsVisibility(event)">
                                <i class="fas fa-chevron-up" id="toggleParamsIcon"></i>
                            </button>
                        </div>
                        <div class="action-buttons">
                            <button class="btn btn-secondary" onclick="resetCompression()">
                                <i class="fas fa-redo"></i> 重置
                            </button>
                            <button class="btn btn-primary" onclick="startCompression()">
                                <i class="fas fa-play"></i> 开始压缩
                            </button>
                        </div>
                    </div>
                    
                    <div class="compression-rounds" id="compressionRounds">
                        <div class="compression-round" data-round="1">
                            <div class="round-header">
                                <div class="round-title">第 1 次压缩</div>
                                <button class="remove-round-btn" onclick="removeCompressionRound(1)" style="display: none;">
                                    <i class="fas fa-times"></i> 移除
                                </button>
                            </div>
                            <div class="params-grid">
                                <div class="param-group">
                                    <label class="param-label">卷积核大小</label>
                                    <input type="number" class="param-input" name="kernel_size" value="5" min="1" max="10">
                                </div>
                                <div class="param-group">
                                    <label class="param-label">Top-K 值</label>
                                    <input type="number" class="param-input" name="top_k" value="150" min="1" max="200">
                                </div>
                                <div class="param-group">
                                    <label class="param-label">分数类型</label>
                                    <select class="param-input" name="score_type">
                                        <option value="1">原始分数</option>
                                        <option value="2">分数加权放大</option>
                                    </select>
                                </div>
                                <div class="param-group">
                                    <label class="param-label">最小分数阈值</label>
                                    <input type="number" class="param-input" name="min_score" value="0" min="0" max="1" step="0.01">
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <button class="add-round-btn" onclick="addCompressionRound()">
                        <i class="fas fa-plus"></i>
                        添加压缩轮次
                    </button>
                </div>

                <!-- Input/Output Layout -->
                <div class="io-container">
                    <!-- Input Section -->
                    <div class="input-section">
                        <div class="section-header">
                            <i class="fas fa-edit"></i>
                            输入内容
                            <button class="input-btn" onclick="loadInputSample()"><i class="fas fa-file-import"></i> 示例</button>
                        </div>
                        <div class="section-content">
                            <textarea 
                                id="inputContent" 
                                class="input-textarea" 
                                placeholder="请输入需要压缩的文本内容...&#10;&#10;支持中文和英文文本，建议输入较长的文本以获得更好的压缩效果。"
                            ></textarea>
                        </div>
                    </div>

                    <!-- Question Section -->
                    <div class="input-section">
                        <div class="section-header">
                            <i class="fas fa-question-circle"></i>
                            压缩指令
                            <button class="input-btn" onclick="loadQuestionSample()"><i class="fas fa-file-import"></i> 示例</button>
                        </div>
                        <div class="section-content">
                            <textarea 
                                id="questionContent" 
                                class="input-textarea" 
                                placeholder="请输入压缩指令或问题...&#10;&#10;例如：请将上述内容压缩为100字以内的摘要，保留核心信息。"
                            ></textarea>
                        </div>
                    </div>
                </div>

                <!-- Results Section -->
                <div class="results-section">
                    <div class="results-header">
                        <div class="output-title">
                            <i class="fas fa-chart-bar"></i>
                            原始内容Token分析
                        </div>
                    </div>
                    <div class="results-content">
                        <div id="originalTokens" class="token-display">
                            <div class="empty-state">
                                <i class="fas fa-file-text"></i>
                                <p>原始内容的Token分析将在这里显示</p>
                                <small style="margin-top: 0.5rem; display: block;">输入内容后开始压缩查看分析结果</small>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Compression Results -->
                <div class="results-section">
                    <div class="results-header">
                        <div class="output-title">
                            <i class="fas fa-compress-alt"></i>
                            压缩结果
                        </div>
                    </div>
                    <div class="results-content">
                        <div id="compressionResultsContainer" class="compression-results">
                            <div class="empty-state">
                                <i class="fas fa-compress-alt"></i>
                                <p>压缩结果将在这里显示</p>
                                <small style="margin-top: 0.5rem; display: block;">配置参数后开始压缩</small>
                            </div>
                        </div>
                    </div>
                </div>
            </main>
        </div>
    </div>

    <!-- 将内联JavaScript分离到外部JS文件 -->
    <script src="scripts/config.js"></script>
    <script src="scripts/compression.js"></script>
</body>
</html>
